<%--
  - Author		:	이 영호(Youngho Lee)	
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript">
			$(function(){
			});

			function goPage(page, target){
				if(target == "pageVertifi"){
					document.searchFrm.pageVertifi.value = page;
					document.searchFrm.submit();
				}else if(target == "pageBoard"){
					document.searchFrm.pageBoard.value = page;
					document.searchFrm.submit();	
				}
			}
			
			function goVertification(type, idx){
				if(type == "1"){
					document.vertificationfrm.type.value="applet";	
				}else if(type == "2"){
					document.vertificationfrm.type.value="pay";
				}else {
					alert("올바르지 않은 접근입니다.");
					return;
				}
				document.vertificationfrm.idx.value=idx;
				document.vertificationfrm.submit();
			}
			
			function goFaq(idx, pw){
				document.detailFrm.idx.value=idx;
				
				if(pw){
					$(".pBoard").show();
				}else {
					document.detailFrm.submit();
				}
				
			}
			
			function chkPw(){
				if(($("#password").val()).replace(/\s/g, '') == ""){
					alert("[비밀번호]를 입력하세요.");
					$("#password").focus();
					return false;
				}else{
					document.detailFrm.password.value=$("#password").val();
					document.detailFrm.submit();	
				}
			}

		</script>
	</head>
	<body>
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="contMenuTitle">
					<img src="<c:url value="${dirImages}/subtit_01_1.gif" />" title="나의 검증/문의" alt="나의 검증/문의">
				</div>
				<div class="secTitle">
					<img src="<c:url value="${dirImages}/icon.png" />" title="검증결과" alt="검증결과" > 검증결과
				</div>
				<form name="searchFrm" method="post" action="<c:url value="/mypage/verification.do" />">
					<input type="hidden" name="maxnumVertifi" value="${maxnumVertifi}" />
					<input type="hidden" name="pageVertifi" value="${pageVertifi}" />
					<input type="hidden" name="maxnumBoard" value="${maxnumBoard}" />
					<input type="hidden" name="pageBoard" value="${pageBoard}" />
					<table class="listTbl linked">
						<thead>
							<tr>
								<th>No.</th>
								<th>검증분야</th>
								<th>검증단계</th>
								<th>검증 신청 일자</th>
								<th class="lastTh">완료 예정 일자</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${vertificationList}" var="vertification" varStatus="stat">
								<tr onclick="javascript:goVertification(${vertification.type}, ${vertification.idx});">
									<td>${vertificationListTotalCnt - stat.index - (maxnumVertifi*(pageVertifi-1))}</td>
									<td>
										<c:choose>
											<c:when test="${vertification.type eq 1}">애플릿 검증</c:when>
											<c:when test="${vertification.type eq 2}">결제기 검증</c:when>
											<c:otherwise>
												${vertification.type}
											</c:otherwise>
										</c:choose>
									</td>
									<td><%-- 검증 상태 (-1:오류, 0:검증 신청, 1:진행중, 2:성공) --%>
										<c:choose>
											<c:when test="${vertification.status eq -1}">검증 오류</c:when>
											<c:when test="${vertification.status eq 0}">검증 신청</c:when>
											<c:when test="${vertification.status eq 1}">검증 중</c:when>
											<c:when test="${vertification.status eq 2}">검증 완료</c:when>
											<c:otherwise>
												${vertification.status}
											</c:otherwise>
										</c:choose>
									</td>
									<td>
										<c:catch var="e">
											<fmt:parseDate var="createdTime" pattern="yyyy-MM-dd HH:mm:ss" value="${vertification.createdTime}" />
											<fmt:formatDate value="${createdTime}" pattern="yyyy/MM/dd" />
										</c:catch>
										<c:if test="${not empty e}">
											${vertification.createdTime}
										</c:if>
									</td>
									<td>
										<c:catch var="e">
											<fmt:parseDate var="completedTime" pattern="yyyy-MM-dd HH:mm:ss" value="${vertification.completedTime}" />
											<fmt:formatDate value="${completedTime}" pattern="yyyy/MM/dd" />
										</c:catch>
										<c:if test="${not empty e}">
											${vertification.completedTime}
										</c:if>
									</td>
								</tr>
							</c:forEach>
						</tbody>
						<c:if test="${vertificationListTotalCnt eq 0}">
							<tfoot>
								<tr>
									<td colspan="5">검증 신청 내용이 없습니다.</td>
								</tr>
							</tfoot>
						</c:if>
					</table>
					<c:if test="${vertificationListTotalCnt ne 0}">
						<div class="pagingWrap">
							<jsp:include page="/WEB-INF/pages/includes/paging.jsp">
								<jsp:param name="totalNum" value="${vertificationListTotalCnt}" />
								<jsp:param name="pageListCnt" value="${maxnumVertifi}" />
								<jsp:param name="pageGrpCnt" value="10" />
								<jsp:param name="pageIdx" value="${pageVertifi}" />
								<jsp:param name="targetPageNm" value="pageVertifi" />
							</jsp:include>
						</div>
					</c:if>
					<br />
					<div class="secTitle">
						<img src="<c:url value="${dirImages}/icon.png" />" title="문의글" alt="문의글" > 문의글
						<div style="float: right;">
							<select name="searchType">
								<option value="title" <c:if test="${param.searchType eq 'title'}"> selected="selected" </c:if>>제목</option>
								<option value="cont" <c:if test="${param.searchType eq 'cont'}"> selected="selected" </c:if>>내용</option>
								<option value="name" <c:if test="${param.searchType eq 'name'}"> selected="selected" </c:if>>작성자</option>
							</select>
							<input type="text" name="searchWord" value="${param.searchWord}" />
							<input type="submit" class="btn btn_search" alt="검색" title="검색" value="">
						</div>
					</div>
					<table class="listTbl linked">
						<thead>
							<tr>
								<th>번호</th>
								<th>제목</th>
								<th>작성자</th>
								<th>날짜</th>
								<th class="lastTh">조회</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${boardList}" var="board" varStatus="stat">
								<tr  onclick="javascript:goFaq(${board.idx}<c:if test="${not empty board.password}">, true</c:if>);">
									<td>${boardListTotalCnt - stat.index - (maxnumBoard*(pageBoard-1))}</td>
									<td ><c:out value="${board.title}" /><c:if test="${not empty board.password}"> <img src="<c:url value="${dirImages}/board_lock_icon.png" />"></c:if></td>
									<td><c:out value="${board.createdNm}" /></td>
									<td>
										<c:catch var="e">
											<fmt:parseDate var="date" pattern="yyyy-MM-dd HH:mm:ss" value="${board.createdTime}" />
											<fmt:formatDate value="${date}" pattern="yyyy.MM.dd" />
										</c:catch>
										<c:if test="${not empty e}">
											${board.createdTime}
										</c:if>
									</td>
									<td><c:out value="${board.viewCnt}" /></td>
								</tr>
							</c:forEach>
						</tbody>
						<c:if test="${boardListTotalCnt eq 0}">
							<tfoot>
								<tr>
									<td colspan="5">문의내용이 없습니다.</td>
								</tr>
							</tfoot>
						</c:if>
					</table>
					<c:if test="${boardListTotalCnt ne 0}">
						<div class="pagingWrap">
							<jsp:include page="/WEB-INF/pages/includes/paging.jsp">
								<jsp:param name="totalNum" value="${boardListTotalCnt}" />
								<jsp:param name="pageListCnt" value="${maxnumBoard}" />
								<jsp:param name="pageGrpCnt" value="10" />
								<jsp:param name="pageIdx" value="${pageBoard}" />
								<jsp:param name="targetPageNm" value="pageBoard" />
							</jsp:include>
						</div>
					</c:if>
				</form>
			</div>
		</div>
		<form name="vertificationfrm" method="post" action="<c:url value="/result/detail.do" />" style="display: none;">
			<input type="hidden" name="type" />
			<input type="hidden" name="idx" />
		</form>
		<div class="popupWrap pBoard" style="display: none;">
			<div class="pTitle">
				비밀번호 입력
				<div class="pClose btn" onclick="javascript:$('.pBoard').hide();"></div>
			</div>
			<div class="pCont">
				<p style="text-align: center;line-height: 25px;">
					비밀번호를 입력하세요.<br />
					(숫자 4자리 입력)<br />
					<input type="password" id="password" title="비밀번호" alt="비밀번호" maxlength="4" />
				</p>
			</div>
			<div class="btnWrap centerBtnWrap">
				<input type="button" class="btn btn_ok" alt="확인" title="확인" onclick="javascript:chkPw();">
			</div>
		</div>
		<form name="detailFrm" method="post" action="<c:url value="/board/detail.do" />" style="display: none;">
			<input type="hidden" name="idx" value="" />
			<input type="hidden" name="password" value="" />
		</form>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
	</body>
</html> 